package com.zzl.zzlojbackendjudgeservice.judge.codesandbox;

import com.zzl.zzlojbackendjudgeservice.judge.codesandbox.impl.ExampleCodeSandbox;
import com.zzl.zzlojbackendjudgeservice.judge.codesandbox.impl.RemoteCodeSandbox;
import com.zzl.zzlojbackendjudgeservice.judge.codesandbox.impl.ThirdpartyCodeSandbox;

/**
 * 工厂模式
 */
public class CodeSandboxFactory {
    public static CodeSandbox newInstance(String type) {
        switch (type) {
            case "example":
                return new ExampleCodeSandbox();
            case "remote":
                return new RemoteCodeSandbox();
            case "thridparty":
                return new ThirdpartyCodeSandbox();
            default:
                return new ExampleCodeSandbox();
        }
    }
}
